<template>
	<view class="content">
		<div class="li" v-for="time in list">
			<div class="img">
				<image :src="time.url" mode="widthFix"></image>
			</div>
			<div class="r">
				<div class="time">{{ time.name }}</div>
				<div class="share" @click="del(time.uid)">删除</div>
			</div>
		</div>

    <uni-popup ref="message" type="dialog">
      <uni-popup-dialog  mode="base" title="确定要删除吗?" :duration="2000" @confirm="confirm"></uni-popup-dialog >
    </uni-popup>
    <!--			 空状态-->
    <div class="null" v-if="list.length <= 0">
      <image src="../../static/null.png" mode="widthFix"></image>
      <div class="text">暂无海报详情信息～</div>
    </div>
	</view>
</template>

<script>
	import Api from "../../API/api";

  export default {
		data() {
			return {
        show:false,
        list:[],
        dels: null
      }
		},
    onShow() {
        this.getList();
		},
		methods: {
      del(value) {
        this.dels = value;
        this.$refs.message.open()
      },
      confirm(){
        uni.showLoading({
          title: '加载中'
        });
        Api.delPoster(this.dels).then(res=>{
          uni.showToast({
            title: '删除成功',
            icon: 'checkmarkempty'
          })
          this.getList();
        })
        uni.hideLoading();
      },
      getList(){
        Api.getQr({type:true}).then(res=>{
          if (res.data.length <= 0){
            this.show = true;
          }else {
            this.show = false;
          }
          this.list = res.data;
        })
      }
		}
	}
</script>

<style lang="less" scoped>
.null {
  position: fixed;
  top: 40%;
  left: 50%;
  transform: translate(-50%,-50%);
  image {
    width: 200rpx;
  }
  .text{
    margin-top: 20rpx;
    color: #aaa;
    font-size: 26rpx;
  }
}
	.content {
		margin: auto;
		width: 90%;

		.li {
			margin-top: 30rpx;
			width: 672rpx;
			height: 280rpx;
			background: #FFFFFF;
			border-radius: 20rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;
			padding: 30rpx;
			box-sizing: border-box;

			.img {
				image {
					width: 120rpx;
				}
			}

			.r {

				.time {
					color: #aaa;
				}

				.share {
					width: 142rpx;
					height: 64rpx;
					border-radius: 32rpx;
					border: 2rpx solid #FD9509;
					display: flex;
					justify-content: center;
					align-items: center;
					color: #FD9509;
					float: right;
					margin-top: 90rpx;
				}
			}
		}
	}
</style>